package inabit.inabitcompiler.productions.variable.types;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.compiler.parser.grammar.Terminal;
import inabit.inabitcompiler.lexical.InabitTokenClass;
import inabit.inabitcompiler.parser.InabitSemanticAction;

/**G' -> ,GG'*/
/**@author Rafael Rocha*/
public class G1_Rule extends Production{
	private NonTerminal G;
	private NonTerminal G1;
	
	public G1_Rule() {
		super("G'");
	}
	
	public Symbol[] production(final NonTerminal nonTerminal){
		G = new NonTerminal("G");
		G1 = new NonTerminal("G'");
		Symbol[] symbols = {
				new Terminal(InabitTokenClass.COMMA),
				G,
				G1,
				new InabitSemanticAction(nonTerminal) {
					public void execute() throws Exception{
						nonTerminal.code = ","+G.code+G1.code;
					}
				}
		};
		return symbols;
	}
}
